﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Data;
using System.Text;


namespace IHISCETeim.Web.MachineSys.FXModel
{
    public partial class ReportYQ2QKFMX : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看 };
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "ReportYQ2QKFMX";
            }
        }

        protected string LeaseCompany
        {
            get
            {
                return GetRequestValue<string>("LeaseCompany", "");
            }
        }
        protected string AliasName
        {
            get
            {
                return GetRequestValue<string>("AliasName", "");
            }
        }

       
        protected DataTableCollection dtc1 = null;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(AliasName))
            {                
                dtc1 = FXFinanceLeaseController.ReportYQ2QKFMX(AliasName);
                this.rpMenu.DataSource = dtc1[0];
                this.rpMenu.DataBind();

            }
        }

        protected string GetAliasNameList()
        {
            DataTable aNList = FXFinanceLeaseController.ReportGetAliasNameJXSYQ2CSLSBP(LeaseCompany);
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("<option value='{0}' {2}>{1}</option>", "", "请选择...", "" == AliasName ? "selected" : "");
            foreach (DataRow dr in aNList.Rows)
            {
                sb.AppendFormat("<option value='{0}' {1}>{0}</option>", dr["AliasName"], dr["AliasName"].ToString() == AliasName ? "selected" : "");
            }

            return sb.ToString();
        }

        protected object GetSum(string filedname)
        {
            if (!string.IsNullOrEmpty(AliasName))
            {
                return dtc1[1].Rows[0][filedname];
            }
            else
                return 0;
        }
    }
}